<?php

class AdminController extends Zend_Controller_Action {

	public function init() {
		// action body
		$this->_helper->layout->disableLayout();
	}

	public function indexAction() {
	}

	public function logAction() {
		$this->makeJsonService('Services_Log');
	}

	private function makeJsonService($serviceName) {
		$server = new Zend_Json_Server();
		$server->setClass($serviceName);

		if ('GET' == $_SERVER['REQUEST_METHOD']) {
			// Indicate the URL endpoint, and the JSON-RPC version used:
			$server->setTarget($this->getRequest()->getPathInfo())
			->setEnvelope(Zend_Json_Server_Smd::ENV_JSONRPC_2);

			// Grab the SMD
			$smd = $server->getServiceMap();

			// Return the SMD to the client
			header('Content-Type: application/json');
			echo $smd;
			return;
		}

		$server->handle();
	}


}

